$(function () {
    $("#jqGrid").jqGrid({
        url:baseURL+"sys/flowNoticeTer/list" ,
        datatype: "json",
        colModel: [
            { label: '流水号', name: 'noticeTerNo', width: 80,align:'center' , sortable: false},
            { label: '开始SN', name: 'startSn', width: 80, align:'center' , sortable: false},
            { label: '结束SN', name: 'endSn', width: 45,align:'center' , sortable: false},
            { label: '分配人', name: 'disName', width: 45,align:'center'},
            { label: '联系方式', name: 'disPhone', width:45,align:'center' , sortable: false},
            { label: '接收人', name: 'acceptName', width:75,align:'center' , sortable: false},
            { label: '联系方式', name: 'acceptPhone', width: 75,align:'center', sortable: false},
            { label: '分配数量', name: 'terNumber', width: 60,align:'center', sortable: false},
            { label: '分配时间', name: 'createDate', width: 60,align:'center' , sortable: false},
            { label: '订单关联', name: 'orderId', width: 60,align:'center',formatter:function (value,options,row) {
                    return value==null?"非订单":value;
                } , sortable: false}

        ],
		viewrecords: true,
        height: 375,
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });


});



var vm = new Vue({
    el:'#rrapp',
    data:{
        q:{
            sn:null,
            disName:null,
            acceptName:null
        },

        showList: true,
        title:null,

    },
    methods: {
        query: function () {
            vm.reload();
        },
        clean: function () {
            vm.showList = true;
            vm.q = {
                sn:null,
                disName:null,
                acceptName:null
            };
            $("#jqGrid").jqGrid('setGridParam', {page: 1});
            vm.reload();
        },
        reload: function () {
            vm.showList = true;
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {
                    'sn': vm.q.sn,
                    'disName': vm.q.disName,
                    'acceptName': vm.q.acceptName
                },
                page: 1
            }).trigger("reloadGrid");
        }
    }
});

